package com.z.controller;

import com.z.pojo.Goods;
import com.z.service.GoodsService;
import com.z.service.impl.GoodsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/goodsInfo")
public class GoodsInfoServlet extends HttpServlet {
    private GoodsService gs = new GoodsServiceImpl();

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String gid = req.getParameter("gid");
        Goods goods = gs.goodsInfo(Integer.valueOf(gid));
        req.setAttribute("goods", goods);
        req.getRequestDispatcher("/proinfo.jsp").forward(req,resp);
    }
}
